package com.shadow.demo.data.shiro.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shadow.demo.data.shiro.entity.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.core.annotation.Order;

import java.util.List;

/**
 * Created by shadow
 * on 2022-6-29.
 */
@Order(1)
@Mapper
public interface PermissionMapper extends BaseMapper<Permission> {

    List<Permission> selectSysPermissionsBySysUserName(String userName);

    List<Permission> selectMenusByRoleId(Integer id);

    /**
     * 根据用户获取权限列表
     *
     * @param userAccount 用户账户
     * @return {@link List} 权限列表
     */
    List<Permission> getPermissionListByUserAccount(String userAccount);

    /**
     * 获取角色下所有的权限项
     * */
    List<Permission> getAllByRoleId(@Param("roleId") String roleId);
}
